package com.demo.zhou.sniper.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.demo.zhou.sniper.R;
import com.demo.zhou.sniper.dbmanger.SPManager;

/**
 * Created by zhou on 2017/6/11.
 */

public class ChoiceActivity extends BaseActivity implements View.OnClickListener {
    private Button choice_bt_zxing, choice_bt_cxun, choice_bt_zli, choice_bt_return;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("选择");
        setRightBtnVisible(false);
        choice_bt_zxing =  findViewById(R.id.choice_bt_zxing);
        choice_bt_cxun =  findViewById(R.id.choice_bt_cxun);
        choice_bt_zli =  findViewById(R.id.choice_bt_zli);
        choice_bt_return = findViewById(R.id.choice_bt_return);
        choice_bt_zxing.setOnClickListener(this);
        choice_bt_cxun.setOnClickListener(this);
        choice_bt_zli.setOnClickListener(this);
        choice_bt_return.setOnClickListener(this);
    }

    @Override
    protected int getContentView() {
        return R.layout.activity_choice;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.choice_bt_zxing:
                goZxing();
                break;
            case R.id.choice_bt_cxun:
                goCxun();
                break;
            case R.id.choice_bt_zli:
                goZli();
                break;
            case R.id.choice_bt_return:
                finish();
                break;
            default:
                break;
        }
    }

    public void goZxing() {
        if (SPManager.getInstance().getInt("gongzxian", -1) < 0) {
            Intent intent = new Intent(ChoiceActivity.this, SetActivity.class);
            startActivity(intent);
        } else {
            Intent intent = new Intent(ChoiceActivity.this, SetDetailsActivity.class);
            startActivity(intent);
        }

    }

    public void goCxun() {
        Intent intent = new Intent(ChoiceActivity.this, ChaxunActivity.class);
        startActivity(intent);
    }

    public void goZli() {
        Intent intent = new Intent(ChoiceActivity.this, ZhengliActivity.class);
        startActivity(intent);
    }
}
